/*
 * Copyright 2010 Florian Sauter
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package de.rentoudu.chat.server.guice;

import com.google.appengine.api.channel.ChannelService;
import com.google.appengine.api.users.UserService;
import com.google.gson.Gson;
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;

import de.rentoudu.chat.server.CurrentChannel;
import de.rentoudu.chat.server.ObjectifyManager;
import de.rentoudu.chat.server.servlet.ChannelTokenServlet;
import de.rentoudu.chat.server.servlet.LogoutServlet;
import de.rentoudu.chat.server.servlet.MessageServlet;
import de.rentoudu.chat.server.serializer.DateSerializer;

/**
 * Module which binds the configurations.
 * 
 * @author Florian Sauter
 */
public class ServerModule extends AbstractModule {
	@Override
	protected void configure() {
		bind(ObjectifyManager.class).in(Singleton.class);
		bind(Gson.class).toProvider(GsonProvider.class).in(Singleton.class);
		
		bind(UserService.class).toProvider(UserServiceProvider.class).in(Singleton.class);
		bind(ChannelService.class).toProvider(ChannelServiceProvider.class).in(Singleton.class);
		
		bind(MessageServlet.class).in(Singleton.class);
		bind(ChannelTokenServlet.class).in(Singleton.class);
		bind(LogoutServlet.class).in(Singleton.class);
		
		bind(CurrentChannel.class).toProvider(CurrentChannelProvider.class).in(Singleton.class);
		
		bind(DateSerializer.class).in(Singleton.class);
	}
}